package com.ym.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.ym.base.BaseController;
import com.ym.entity.User;
import com.ym.service.IUserService;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hzbjcym
 * @since 2017-05-05
 */
@Controller
@RequestMapping("/test/user")
public class UserController extends BaseController{
	
	@Autowired
	protected IUserService userService;
	
	@RequestMapping("/selectUserList.do")
	public ModelAndView selectUserList(HttpServletRequest req){
		User user = new User();
		EntityWrapper<User> ew = new EntityWrapper<User>();
		ew.setEntity(user);
		List<User> list = userService.selectList(ew);
		System.out.println(JSON.toJSONString(list));
    	ModelAndView m = new ModelAndView();
    	m.setViewName("../views/index");
    	return m;
	}
}
